using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

/**
*@file       LSPassport_VerifyReciever.cs
*@brief      process message LSPassport_Verify
*
*@author     graywind
*@version    1.0.0.1
*@data       2012/3/19
*/

//process LSPassport_Verify
public class OnLSPassport_Verify
{
    /// <summary>
    /// process message
    /// </summary>
    /// <param name="op">message operator</param>
    /// <param name="session_id">session identifier</param>
    /// <param name="msg_buffer">message buffer</param>
    /// <param name="msg_bytes">buffer length</param>
    public static void OnMapping(IMessageOperator op, Int32 session_id, byte[] msg_buffer, UInt32 msg_bytes)
    {
        //TODO
		loginserver.PassportVerify pv = ProtoNet<loginserver.PassportVerify>.CreateFromBytes(msg_buffer, msg_bytes);
        if (op.CheckPassport(pv.UsrId, pv.Passport) == true)
        {
			msgLSPassport_Verify_Success msg = new msgLSPassport_Verify_Success(session_id, pv.GateCode);
            gwMessagePort.ProcessMessage(msg);
        }
        else
        {
			msgLSPassport_Verify_Failed msg = new msgLSPassport_Verify_Failed(session_id, pv.GateCode);
            gwMessagePort.ProcessMessage(msg);
        }
    }
}

//register callback
partial class MessageProcTypes<ProcType, MessageProc>
{
        [MessageProcType((int)LoginServerTypes.MessageType.LSPassport_Verify)]
        public static LoginServerProcessor.LoginServerTabFunc LSPassport_VerifyProc = new LoginServerProcessor.LoginServerTabFunc(OnLSPassport_Verify.OnMapping);
}
